#include "Render/PiccoloSampler.h"
#include "Render/PiccoloRenderContext.h"

#include "PiccoloApplication.h"

namespace Piccolo
{
    PiccoloSampler::PiccoloSampler(VkFilter filter, VkSamplerAddressMode addressMode) : mFilter(filter), mAddressMode(addressMode)
    {
        PiccoloRenderContext* renderContext = PiccoloApplication::GetAppContext()->renderContext;
        PiccoloVKDevice* device = renderContext->GetDevice();

        CALL_VK(device->CreateSimpleSampler(mFilter, mAddressMode, &mSampler));
    }

    PiccoloSampler::~PiccoloSampler()
    {
        PiccoloRenderContext* renderContext = PiccoloApplication::GetAppContext()->renderContext;
        PiccoloVKDevice* device = renderContext->GetDevice();
        VK_D(Sampler, device->GetLogicDevice(), mSampler);
    }
}
